{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"result\": \"success\", \"success\": [], \"fail\": [{\"imageId\": \"78d232b9d0774466a2cec8a104f84ede\", \"name\": \"C:\\\\Users\\\\user\\\\Pictures\\\\2002\\\\07\\\\19\\\\big\\\\img_90.jpg\", \"errCode\": 1002, \"errReason\": \"SDK_ERROR:_CONVERT_FROM_BIN_FAILED\"}], \"time_used\": 20}\n"
     ]
    }
   ],
   "source": [
    "import requests\n",
    "target_image_path=r\"C:\\Users\\user\\Pictures\\2002\\07\\19\\big\\img_18.jpg\"\n",
    "url = \"http://192.168.1.111:9001/verify/face/synAdd\"\n",
    "imb=open(target_image_path, 'r')\n",
    "payload = \"------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"dbName\\\"\\r\\n\\r\\nsj1\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"imageDatas\\\"; filename=\\\"C:\\\\Users\\\\user\\\\Pictures\\\\2002\\\\07\\\\19\\\\big\\\\img_90.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\\r\\n{imageData}\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"getFeature\\\"\\r\\n\\r\\n1\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW--\".format(\n",
    "imageData=imb)\n",
    "headers = {\n",
    "    'content-type': \"multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW\",\n",
    " \n",
    "    }\n",
    "\n",
    "response = requests.request(\"POST\", url, data=payload, headers=headers)\n",
    "\n",
    "print(response.text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "if u\"2.2\">1:\n",
    "    True\n",
    "else:\n",
    "    False"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
